package org.intelligentsia.keystone.option;

import org.intelligentsia.keystone.option.Options.Multiplicity;
import org.intelligentsia.keystone.option.Options.Separator;

/**
 * java Example1_mod [-a] [-log=<logfile>] <inpfile> <outfile>
 */

public class Example1_mod {

	public static void main(final String args[]) {

		final Options opt = new Options(args, Multiplicity.ZERO_OR_ONE, 2);

		opt.getSet().addOption("a").addOption("log", Separator.EQUALS);

		if (!opt.check()) {
			// Print usage hints
			System.exit(1);
		}

		// Normal processing

		if (opt.getSet().isSet("a")) {
			// React to option -a
			System.out.println("a is set");
		}
		if (opt.getSet().isSet("log")) {
			// React to option -log
			final String logfile = opt.getSet().getOption("log").getResultValue(0);
			System.out.println("logfile " + logfile);
		}

		final String inpfile = opt.getSet().getData().get(0);
		final String outfile = opt.getSet().getData().get(1);
		System.out.println("inpfile " + inpfile);
		System.out.println("outfile " + outfile);

	}
}
